import { Component, OnInit, ViewChild } from '@angular/core';
import { ColumnType, SPage, TablePageComponent } from '@shared/components/table-page/table-page.component';
import { NzMessageService, NzModalService } from 'ng-zorro-antd';
import { ApiService } from '@core/services/api';
import {HttpClient} from "@angular/common/http";
import { PermissionService } from '@core/services/permission.service';
import { ACLService } from '@delon/acl';
import { STData } from '@delon/abc';
@Component({
  selector: 'app-inout-money-list',
  templateUrl: './inout-money-list.component.html',
  styles: []
})
export class InoutMoneyListComponent implements OnInit {
  @ViewChild('st', {static: false})st: TablePageComponent;
  config: SPage = {
    columns: [
      {
        index: 'name',
        title: '用户姓名',
        filter: {
          type: 'string'
        }
      },
      {
        index: 'phone',
        title: '手机号',
        filter:{
          type:'string',
        }
      },
      {
        index: 'payName',
        title: '缴费人',
        filter:{
          index:'beginPayTime',
          placeholder:'支付开始时间',
          type:'date',
        }
      },
      {
        index: 'payMoney',
        title: '缴费金额(元)',
         fFn:(item,column)=>{
          return item.payMoney / 100 + "";
        },
        statistical: 'sum',
        key: 'payMoney',
        // filter:{
        //   type:'string',
        // }
      },
      {
        index: 'payTime',
        title: '支付时间',
        filter:{
          index:'endPayTime',
          placeholder:'支付结束时间',
          type:'date',
        }
      },
    ],
    reqUrl: "/core/qr/pay/getOutInPayRecord",
  };
  selectedData: object[];
  //数据预处理
  dataProcess(data: STData[]){
    return data;
  }
  _selectChange(e): void {
    this.selectedData = e;
  }
  constructor(
    private modal: NzModalService,
    private msg: NzMessageService,
    private api: ApiService,
    private http: HttpClient,
    private permission: PermissionService,
    private aclService: ACLService
  ) { }
  getData(e):void{
    this.http.put('/core/qr/pay/delete',{id:e.id}).subscribe((res:any) => {
      if(res.status === '200'){
        this.msg.success('删除成功');
        this.st.reload();
      }else{
        this.msg.warning(res.message)
      }
    })
  }
  ngOnInit() {
  }
}
